// https://nuxt.com/docs/api/configuration/nuxt-config
const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}
export default ({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  //modules: ["nuxt-proxy-request"],
  plugins:[
    "~/plugins/initplus.ts"
  ],
  // i18n:{
  //   locales: ['en', 'zh'],
  //   defaultLocale: 'zh',
  //   vueI18n: {
  //     locale: 'zh',
  //     fallbackLocale: 'zh',
  //     messages: {
  //       en: require
  //     }
  //   }
  // },
  proxy: {
      options:[{
        '/api': {
        //target: 'http://localhost:5147',
        target: 'https://api.bmyx.love',
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
      }]
  },
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  },
  chainWebpack: (config) => {
    config.resolve.alias.set('vue-i18n', 'vue-i18n/dist/vue-i18n.cjs.js')
    config.module.rule('svg').exclude.add(resolve('src/icons')).end()
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
      .end()
  }
})
